import { createStore } from 'vuex'
import  mutfunc from './mutations.js' 
import {getWorkMessageNum} from '../api/api'
import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/el-loading.css';
import 'element-plus/theme-chalk/el-message.css';

export default createStore({
  state: {
    count:0,
    infonmessga:0,
    identity:0
  },
  getters: {
    js(state){
       let jss='我是计算过的值'+(state.count+3)
      return jss
    }
    
    
  },
  mutations: mutfunc,
  actions: {
    // setInterval(()=>{

    // },10000)
    actNameChage(context) {
      setInterval(function(){
        getWorkMessageNum({userid:localStorage.getItem('userinfoId')}).then((res)=>{
          context.commit('mutNameChage', res.messageNum);

        })
        
      },100000)
      // set (() => {
       
      // }, 10000)
    //   setInterval(()=>{
    //     getWorkMessageNum(userid : localStorage.getItem('userinfoId')).then(

    //     )
    // },10000)
    }
    
    
  },
  modules: {
  }
})
